package com.tywj.buscustomerapp.view.activity.tour;

import android.content.Context;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.tywj.buscustomerapp.R;
import com.tywj.buscustomerapp.view.activity.BaseActivity;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;
import com.youth.banner.loader.ImageLoaderInterface;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

import static com.youth.banner.BannerConfig.CENTER;
import static com.youth.banner.BannerConfig.CIRCLE_INDICATOR;

public class GoodsInfoActivity extends BaseActivity {
    @BindView(R.id.banner)
    Banner banner;

    private List<String> imgs = new ArrayList<>();
    @Override
    protected int getContentId() {
        return R.layout.activity_goods_info;
    }

    @Override
    protected void initWidget(Bundle savedInstanceState) {
        super.initWidget(savedInstanceState);
        imgs.add("http://file.cd917.com/pics/201806/27b457b6-aaea-4ded-9080-deadb1b4ff37_middle.jpg");
        imgs.add("http://file.cd917.com/pics/201806/37227918-a57c-4edd-9315-ed1be31fafeb_middle.JPG");
        imgs.add("http://file.cd917.com/pics/201806/f5300fc2-2c2d-43cc-93c8-7c952db699c0_middle.jpg");
        banner.setBannerStyle(CIRCLE_INDICATOR);
        banner.setIndicatorGravity(CENTER);
        banner.setImageLoader(new LocalImageHolderView()).setImages(imgs).
                setDelayTime(2500).setIndicatorGravity(CENTER).start();
    }

    public static class LocalImageHolderView implements ImageLoaderInterface<ImageView> {
        @Override
        public void displayImage(Context context, Object path, ImageView imageView) {
            Glide.with(context).load(path).into(imageView);
        }
        @Override
        public ImageView createImageView(Context context) {
            ImageView sdw = new ImageView(context);
            sdw.setBackgroundResource(R.drawable.seachbg);
            return sdw;
        }
    }

}
